package com.qf.freemarkerdemo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Arrays;

@Controller
public class TestController {

    /*
        返回值代表的是视图
     */
    @RequestMapping("/test01")
    public String test01(Model model){

        model.addAttribute("msg","hello freemarker...");

        model.addAttribute("score",85);

        model.addAttribute("hobbies", Arrays.asList("study","shopping","game"));

        return "test"; //会去找templates下的test.ftl填充模板，并且返回到浏览器
    }
}
